package b.d;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.res.TypedArray;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import b.b.c.f;

@SuppressLint({"SyntheticAccessor"})
/* compiled from: FingerprintDialogFragment */
public class c extends b.l.a.b {
    public c i0 = new c();
    public Bundle j0;
    public int k0;
    public int l0;
    public int m0;
    public ImageView n0;
    public TextView o0;
    public Context p0;
    public boolean q0 = true;
    public OnClickListener r0;
    public final OnClickListener s0 = new a();

    /* compiled from: FingerprintDialogFragment */
    public class a implements OnClickListener {

        /* compiled from: FingerprintDialogFragment */
        public class a implements Runnable {
            public final /* synthetic */ DialogInterface a;

            public a(DialogInterface dialogInterface) {
                this.a = dialogInterface;
            }

            public void run() {
                c.this.onCancel(this.a);
            }
        }

        public void onClick(DialogInterface dialogInterface, int i) {
            if (i == -2) {
                j.c("FingerprintDialogFrag", c.this.e(), c.this.j0, new a(dialogInterface));
            }
        }
    }

    /* compiled from: FingerprintDialogFragment */
    public class b implements OnClickListener {
        public void onClick(DialogInterface dialogInterface, int i) {
            if (c.this.j0.getBoolean("allow_device_credential")) {
                c.this.s0.onClick(dialogInterface, i);
                return;
            }
            OnClickListener onClickListener = c.this.r0;
            if (onClickListener != null) {
                onClickListener.onClick(dialogInterface, i);
            } else {
                Log.w("FingerprintDialogFrag", "No suitable negative button listener.");
            }
        }
    }

    /* compiled from: FingerprintDialogFragment */
    public final class c extends Handler {
        public void handleMessage(Message message) {
            boolean z = true;
            c cVar;
            CharSequence charSequence;
            c cVar2;
            TextView textView;
            switch (message.what) {
                case 1:
                    cVar = c.this;
                    charSequence = (CharSequence) message.obj;
                    cVar.t0(2);
                    cVar.i0.removeMessages(4);
                    TextView textView2 = cVar.o0;
                    if (textView2 != null) {
                        textView2.setTextColor(cVar.k0);
                        cVar.o0.setText(charSequence);
                    }
                    cVar2 = cVar.i0;
                    cVar2.sendMessageDelayed(cVar2.obtainMessage(4), 2000);
                    return;
                case 2:
                    cVar = c.this;
                    charSequence = (CharSequence) message.obj;
                    cVar.t0(2);
                    cVar.i0.removeMessages(4);
                    textView = cVar.o0;
                    if (textView != null) {
                        textView.setTextColor(cVar.k0);
                        cVar.o0.setText(charSequence);
                    }
                    cVar2 = cVar.i0;
                    cVar2.sendMessageDelayed(cVar2.obtainMessage(3), (long) c.r0(cVar.p0));
                    return;
                case 3:
                    cVar = c.this;
                    charSequence = (CharSequence) message.obj;
                    if (cVar.q0) {
                        cVar.q0();
                    } else {
                        textView = cVar.o0;
                        if (textView != null) {
                            textView.setTextColor(cVar.k0);
                            if (charSequence != null) {
                                cVar.o0.setText(charSequence);
                            } else {
                                cVar.o0.setText(2131689921);
                            }
                        }
                        cVar.i0.postDelayed(new d(cVar), (long) c.r0(cVar.p0));
                    }
                    cVar.q0 = true;
                    return;
                case 4:
                    c cVar3 = c.this;
                    cVar3.t0(1);
                    TextView textView3 = cVar3.o0;
                    if (textView3 != null) {
                        textView3.setTextColor(cVar3.l0);
                        cVar3.o0.setText(cVar3.p0.getString(2131689918));
                        return;
                    }
                    return;
                case 5:
                    c.this.q0();
                    return;
                case 6:
                    Context k = c.this.k();
                    cVar = c.this;
                    if (k == null || !j.d(k, Build.MODEL)) {
                        z = false;
                    }
                    cVar.q0 = z;
                    return;
                default:
                    return;
            }
        }
    }

    public static int r0(Context context) {
        return (context == null || !j.d(context, Build.MODEL)) ? 2000 : 0;
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        Context k = k();
        this.p0 = k;
        if (VERSION.SDK_INT >= 26) {
            this.k0 = s0(16844099);
        } else {
            this.k0 = b.i.c.a.b(k, 2131099689);
        }
        this.l0 = s0(16842808);
    }

    public void N() {
        this.E = true;
        this.i0.removeCallbacksAndMessages(null);
    }

    public void P() {
        this.E = true;
        this.m0 = 0;
        t0(1);
    }

    public void Q(Bundle bundle) {
        super.Q(bundle);
        bundle.putBundle("SavedBundle", this.j0);
    }

    public Dialog n0(Bundle bundle) {
        if (bundle != null && this.j0 == null) {
            this.j0 = bundle.getBundle("SavedBundle");
        }
        b.b.c.f.a aVar = new b.b.c.f.a(k());
        CharSequence charSequence = this.j0.getCharSequence("title");
        androidx.appcompat.app.AlertController.b bVar = aVar.a;
        bVar.d = charSequence;
        View inflate = LayoutInflater.from(bVar.a).inflate(2131492960, null);
        TextView textView = (TextView) inflate.findViewById(2131296563);
        TextView textView2 = (TextView) inflate.findViewById(2131296560);
        CharSequence charSequence2 = this.j0.getCharSequence("subtitle");
        if (TextUtils.isEmpty(charSequence2)) {
            textView.setVisibility(8);
        } else {
            textView.setVisibility(0);
            textView.setText(charSequence2);
        }
        CharSequence charSequence3 = this.j0.getCharSequence("description");
        if (TextUtils.isEmpty(charSequence3)) {
            textView2.setVisibility(8);
        } else {
            textView2.setVisibility(0);
            textView2.setText(charSequence3);
        }
        this.n0 = (ImageView) inflate.findViewById(2131296562);
        this.o0 = (TextView) inflate.findViewById(2131296561);
        if (this.j0.getBoolean("allow_device_credential")) {
            charSequence3 = x(2131689760);
        } else {
            charSequence3 = this.j0.getCharSequence("negative_text");
        }
        b bVar2 = new b();
        androidx.appcompat.app.AlertController.b bVar3 = aVar.a;
        bVar3.i = charSequence3;
        bVar3.j = bVar2;
        bVar3.t = inflate;
        bVar3.s = 0;
        f a = aVar.a();
        a.setCanceledOnTouchOutside(false);
        return a;
    }

    public void onCancel(DialogInterface dialogInterface) {
        e eVar = (e) this.r.b("FingerprintHelperFragment");
        if (eVar != null) {
            eVar.m0(1);
        }
    }

    public void q0() {
        if (this.r == null) {
            Log.e("FingerprintDialogFrag", "Failed to dismiss fingerprint dialog fragment. Fragment manager was null.");
        } else {
            m0(true, false);
        }
    }

    public final int s0(int i) {
        TypedValue typedValue = new TypedValue();
        this.p0.getTheme().resolveAttribute(i, typedValue, true);
        TypedArray obtainStyledAttributes = e().obtainStyledAttributes(typedValue.data, new int[]{i});
        int color = obtainStyledAttributes.getColor(0, 0);
        obtainStyledAttributes.recycle();
        return color;
    }

    /* JADX WARNING: Removed duplicated region for block: B:20:0x0035  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0034 A:{RETURN} */
    public final void t0(int r6) {
        /*
        r5 = this;
        r0 = r5.n0;
        if (r0 != 0) goto L_0x0005;
    L_0x0004:
        return;
    L_0x0005:
        r0 = android.os.Build.VERSION.SDK_INT;
        r1 = 23;
        if (r0 < r1) goto L_0x005c;
    L_0x000b:
        r0 = r5.m0;
        r1 = 2131230966; // 0x7f0800f6 float:1.8078E38 double:1.0529680037E-314;
        r2 = 0;
        r3 = 2;
        r4 = 1;
        if (r0 != 0) goto L_0x0018;
    L_0x0015:
        if (r6 != r4) goto L_0x0018;
    L_0x0017:
        goto L_0x001c;
    L_0x0018:
        if (r0 != r4) goto L_0x0020;
    L_0x001a:
        if (r6 != r3) goto L_0x0020;
    L_0x001c:
        r1 = 2131230967; // 0x7f0800f7 float:1.8078002E38 double:1.052968004E-314;
        goto L_0x002a;
    L_0x0020:
        if (r0 != r3) goto L_0x0025;
    L_0x0022:
        if (r6 != r4) goto L_0x0025;
    L_0x0024:
        goto L_0x002a;
    L_0x0025:
        if (r0 != r4) goto L_0x0031;
    L_0x0027:
        r0 = 3;
        if (r6 != r0) goto L_0x0031;
    L_0x002a:
        r0 = r5.p0;
        r0 = r0.getDrawable(r1);
        goto L_0x0032;
    L_0x0031:
        r0 = r2;
    L_0x0032:
        if (r0 != 0) goto L_0x0035;
    L_0x0034:
        return;
    L_0x0035:
        r1 = r0 instanceof android.graphics.drawable.AnimatedVectorDrawable;
        if (r1 == 0) goto L_0x003c;
    L_0x0039:
        r2 = r0;
        r2 = (android.graphics.drawable.AnimatedVectorDrawable) r2;
    L_0x003c:
        r1 = r5.n0;
        r1.setImageDrawable(r0);
        if (r2 == 0) goto L_0x005a;
    L_0x0043:
        r0 = r5.m0;
        r1 = 0;
        if (r0 != 0) goto L_0x004c;
    L_0x0048:
        if (r6 != r4) goto L_0x004c;
    L_0x004a:
        r4 = 0;
        goto L_0x0055;
    L_0x004c:
        if (r0 != r4) goto L_0x0051;
    L_0x004e:
        if (r6 != r3) goto L_0x0051;
    L_0x0050:
        goto L_0x0055;
    L_0x0051:
        if (r0 != r3) goto L_0x004a;
    L_0x0053:
        if (r6 != r4) goto L_0x004a;
    L_0x0055:
        if (r4 == 0) goto L_0x005a;
    L_0x0057:
        r2.start();
    L_0x005a:
        r5.m0 = r6;
    L_0x005c:
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: b.d.c.t0(int):void");
    }
}
